package com.ucpaas.paas.web.controller;


import com.ucpaas.paas.test.entity.PaasShortUrlTest;
import com.ucpaas.paas.test.service.PaasShortUrlTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/menue")
public class TestController extends BaseController {

    //    @Autowired
//    private PaasMenuService paasMenuService;
    @Autowired
    private PaasShortUrlTestService testService;


    @RequestMapping(path = "/add", method = RequestMethod.GET)
    @ResponseBody
    public String menuAdd() {

//        PaasMenu menu = new PaasMenu();
//        menu.setAppId(10);
//        menu.setCreateUid(10L);
//        menu.setId(10000L);
//        menu.setLevel(1);
//        menu.setName("测试");
//        menu.setRemark("备注");
//        menu.setUrl("asdasd");
//        menu.setType(1);
//        menu.setParentId(1);
//        menu.setSort(1);
//        menu.setStatus(1);
//        menu.setCreateUid(10L);
//        menu.setUpdateUid(10L);
//        paasMenuService.insert(menu);
        return "hello";
    }

//    @RequestMapping(path = "/list", method = RequestMethod.GET)
//    @ResponseBody
//    public List<PaasMenu> menuList() {
////        Map<String, Object> map = new HashMap<>();
////        List<PaasMenu> list = paasMenuService.findList(map);
////        return list;
//        return null;
//    }


    @RequestMapping(path = "/test/list", method = RequestMethod.GET)
    @ResponseBody
    public List<PaasShortUrlTest> testlist() {
        Map<String, Object> map = new HashMap<>();
        List<PaasShortUrlTest> list = testService.findList(map);
        return list;
    }

    @RequestMapping(path = "/test/add", method = RequestMethod.GET)
    @ResponseBody
    public String testAdd() {
        PaasShortUrlTest test = new PaasShortUrlTest();
        test.setName("test");
        testService.insert(test);
        return "hello";
    }

}
